package com.yxhl.zoume.core.user.ui.fragment.identification;


import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.yxhl.zoume.IdentificationCheckDataBinding;
import com.yxhl.zoume.R;
import com.yxhl.zoume.UIConstants;
import com.yxhl.zoume.common.ui.fragment.BaseDataBindingFragment;
import com.yxhl.zoume.core.user.ui.activity.NameIdentificationActivity;
import com.yxhl.zoume.data.http.rest.response.identification.IdentificationResponse;

/**
 * created by sugarya
 * 实名认证 审核中
 */
public class IdentificationCheckFragment extends BaseDataBindingFragment {

    IdentificationResponse mIdentificationResponse;
    IdentificationCheckDataBinding mIdentificationCheckDataBinding;

    public IdentificationCheckFragment() {
        // Required empty public constructor
    }

    public static IdentificationCheckFragment newInstance(IdentificationResponse identificationResponse) {
        Bundle bundle = new Bundle();
        bundle.putSerializable(UIConstants.IDCertify.ARGUMENT_KEY_ID_CERTIFY, identificationResponse);

        IdentificationCheckFragment fragment = new IdentificationCheckFragment();
        fragment.setArguments(bundle);
        return fragment;
    }


    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        parseArguments();
    }
    //    @Override
//    public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                             Bundle savedInstanceState) {
//        View view = super.onCreateView(inflater,container,savedInstanceState);
//
//        return view;
//    }


    private void parseArguments() {
        Bundle bundle = getArguments();
        if (bundle != null) {
            mIdentificationResponse = (IdentificationResponse)
                    bundle.getSerializable(UIConstants.IDCertify.ARGUMENT_KEY_ID_CERTIFY);
            mIdentificationCheckDataBinding.setResponse(mIdentificationResponse);
        }
    }


    @Override
    protected void initializeInjector() {

    }

    @Override
    protected View getContentLayout(LayoutInflater inflater, ViewGroup container) {
        mIdentificationCheckDataBinding = DataBindingUtil.inflate(inflater,
                R.layout.fragment_identification_check, container, false);
        return mIdentificationCheckDataBinding.getRoot();
    }

//    @Override
//    protected int getLayoutResId() {
//        return R.layout.fragment_identification_error;
//    }

    @Override
    protected void setupToolBar() {
        ((NameIdentificationActivity) mActivity).setToolbarTitle(R.string.identification_header_title);
    }

}
